import * as echarts from "echarts";
import { useEffect, useRef } from "react";

const MyCharts = ({ options }: any) => {
  const divRef = useRef(null);

  useEffect(() => {
    // 实例化
    const my = echarts.init(divRef.current as unknown as HTMLElement);

    my.setOption(options);
  });

  return <div ref={divRef} style={{ height: 200 }}></div>;
};

export default MyCharts;
